package test3;

public class GirlFriendTest {
    public static void main(String[] args) {
        GirlFriend[] array = new GirlFriend[4];

        GirlFriend gf1 = new GirlFriend("小金金",18,"爱吹萧");
        GirlFriend gf2 = new GirlFriend("小田田",19,"爱吃糖");
        GirlFriend gf3 = new GirlFriend("小彤彤",21,"爱学习");
        GirlFriend gf4 = new GirlFriend("小鑫鑫",20,"爱看书");
        array[0] = gf1;
        array[1] = gf2;
        array[2] = gf3;
        array[3] = gf4;
        int sum=0;
        for(int i=0;i<array.length;i++){
            GirlFriend gf = array[i];
            sum=sum+array[i].getAge();
        }
        int avg = sum/array.length;
        int count=0;
        for(int i=0;i<array.length;i++){
            GirlFriend gf = array[i];
            if(gf.getAge()<avg){
                count++;
                System.out.println(gf.getName()+","+ gf.getAge()+","+gf.getHobby());
            }
        }
    }
}
